{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
  <div class="medium-9 columns">
    <div class="section">
      <div class="section__body">
        <form method="post">
          <div class="row">
            {{ form.form_select(columns=4, label='Rule', name='rule', options=rules, value=tdoc['rule']|default(''), row=False) }}
            {{ form.form_text(columns=8, label='Title', name='title', placeholder=_('title'), value=tdoc['title']|default(''), autofocus=True, row=False) }}
          </div><div class="row">
            {{ form.form_text(columns=4, label='Begin Date', name='begin_at_date', placeholder='YYYY-mm-dd', value=date_text, date=True, row=False) }}
            {{ form.form_text(columns=4, label='Begin Time', name='begin_at_time', placeholder='HH:MM', value=time_text, time=True, row=False) }}
            {{ form.form_text(columns=4, label='Duration (hours)', name='duration', value=duration|default('3'), row=False) }}
          </div>
          {{ form.form_text(columns=None, label='Problems', name='pids', value=pids) }}
          {{ form.form_textarea(columns=None, label='Content', name='content', value=tdoc['content']|default(''), markdown=True) }}
          <div class="row"><div class="columns">
            <input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
          {% if page_name == 'contest_edit' %}
            <button type="submit" class="rounded primary button">
              {{ _('Update') }}
            </button>
          {% else %}
            <button type="submit" class="rounded primary button">
              {{ _('Create') }}
            </button>
          {% endif %}
            <button type="button" class="rounded button" onclick="window.history.go(-1)">
              {{ _('Cancel') }}
            </button>
          </div></div>
        </form>
      </div>
    </div>
  </div>
  <div class="medium-3 columns">
    {% include 'components/md_hint.html' %}
  </div>
</div>
{% endblock %}
